package com.example.mytoolbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.os.Bundle;
import android.util.Log;

/**
 * MainActivity
 * @author lijiguo
 */
public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // 获取Toolbar
        Toolbar tb = findViewById(R.id.my_tb);

        // 设置ToolBar返回按钮点击事件
        tb.setNavigationOnClickListener(v -> {
            Log.i(TAG, "Toolbar Clicked...");
        });
    }
}